/*
 * @Author: chengsl
 * @Date: 2023-01-10 15:05:21
 * @LastEditors: chengsl
 * @LastEditTime: 2023-01-10 15:09:33
 * @Description: 气泡地图 widgetAirBubbleMap
 */

const maxSize4Pin = 100
const minSize4Pin = 20
const max = 6000
const min = 10
export default {
  tooltip: {
    trigger: 'item',
    formatter: function(params) {
			if (params.value.length > 1) {
				return params.data.name + '' + params.data.value[2]
			} else {
				return params.name
			}
		}
  },
  geo: {
    map: 'china',
    show: true,
    roam: true,
    label: {
      emphasis: { show: false },
      normal: {
        position: 'right',
        show: true,
        color: '#D4EEFF',
        fontSize: 15,
        fontWeight: 'normal'
      }
    },
    itemStyle: {
      normal: {
        areaColor: {
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            { offset: 0, color: '#0060FF' },
            { offset: 1, color: '#3BD6FF' }
          ]
        },
        borderColor: '#215495',
        borderWidth: 1
      },
      emphasis: { areaColor: '#3BD6FF' }
    }
  },
  series: [
    {
      type: 'effectScatter',
      coordinateSystem: 'geo',
      roam: true,
      rippleEffect: { brushType: 'stroke' },
      showEffectOn: 'render',
      itemStyle: { normal: { color: '' } },
      label: {
        normal: {
          show: true,
          color: '#fff',
          fontWeight: 'bold',
          position: 'inside',
          formatter: function(para) {
						return '{cnNum|' + para.data.value[2] + '}'
					},
          rich: {
            cnNum: { fontSize: 15, color: '#D4EEFF', fontWeight: 'normal' }
          }
        }
      },
      symbol: 'circle',
      symbolSize: function(val) {
				if (val[2] === 0) {
					return 0
				}
				return (
					((maxSize4Pin - minSize4Pin) / (max - min)) * val[2] +
					(maxSize4Pin -
						((maxSize4Pin - minSize4Pin) / (max - min)) * max) *
						1.2
				)
			},
      data: [
        { name: '北京市', value: [116.4551, 40.2539, 524] },
        { name: '天津市', value: [117.4219, 39.4189, 14] },
        { name: '上海市', value: [121.4648, 31.2891, 150] },
        { name: '重庆市', value: [108.384366, 30.439702, 75] },
        { name: '河北省', value: [114.4995, 38.1006, 13] },
        { name: '河南省', value: [113.4668, 34.6234, 83] },
        { name: '云南省', value: [102.9199, 25.4663, 11] },
        { name: '辽宁省', value: [123.1238, 42.1216, 19] },
        { name: '黑龙江省', value: [127.9688, 45.368, 15] },
        { name: '湖南省', value: [113.0823, 28.2568, 69] },
        { name: '安徽省', value: [117.29, 32.0581, 260] },
        { name: '山东省', value: [117.1582, 36.8701, 39] },
        { name: '新疆维吾尔自治区', value: [87.9236, 43.5883, 4] },
        { name: '江苏省', value: [118.8062, 31.9208, 31] },
        { name: '浙江省', value: [119.5313, 29.8773, 104] },
        { name: '江西省', value: [116.0046, 28.6633, 36] },
        { name: '湖北省', value: [114.3896, 30.6628, 1052] },
        { name: '广西壮族自治区', value: [108.479, 23.1152, 33] },
        { name: '甘肃省', value: [103.5901, 36.3043, 347] },
        { name: '山西省', value: [112.3352, 37.9413, 8] },
        { name: '内蒙古自治区', value: [110.3467, 41.4899, 157] },
        { name: '陕西省', value: [109.1162, 34.2004, 22] },
        { name: '吉林省', value: [125.8154, 44.2584, 4] },
        { name: '福建省', value: [119.4543, 25.9222, 36] },
        { name: '贵州省', value: [106.6992, 26.7682, 39] },
        { name: '广东省', value: [113.12244, 23.009505, 996] },
        { name: '青海省', value: [101.4038, 36.8207, 27] },
        { name: '西藏自治区', value: [91.11, 29.97, 31] },
        { name: '四川省', value: [103.9526, 30.7617, 46] },
        { name: '宁夏回族自治区', value: [106.3586, 38.1775, 16] },
        { name: '海南省', value: [110.3893, 19.8516, 22] },
        { name: '台湾省', value: [121.5135, 25.0308, 6] },
        { name: '香港', value: [114.173355, 22.320048, 2] },
        { name: '澳门', value: [113.54909, 22.198951, 9] }
      ],
      zlevel: 1,
      animationDurationUpdate: 0
    }
  ],
  title: {
    show: true,
    text: '',
    left: 'left',
    textStyle: { color: '#fff', fontSize: 20, fontWeight: 'normal' },
    subtext: '',
    subtextStyle: { color: '#fff', fontWeight: 'normal', fontSize: 12 }
  }
}
